<template>
  <div class="house-list">
    <div @click="goToDetail" class="house-item" v-for="(item, index) in houseList" :key="index">
      <img :src="item.image" alt="房源图片" />
      <div class="house-info">
        <h3>{{ item.title }}</h3>
        <p>{{ item.description }}</p>
        <span>{{ item.price }}/月</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      houseList: [
      {
        title: '111',
        description: '一室/东/金沙雅苑(二期)',
        price: '1元/月',
        image: 'path-to-image-1.png' // 替换为实际图片路径
      },
      {
        title: '1234',
        description: '四室/123/西/眉州路515弄',
        price: '123元/月',
        image: 'path-to-image-2.png' // 替换为实际图片路径
      },
      {
        title: '123范德萨发',
        description: '一室/3333/东/思南路115弄',
        price: '111113元/月',
        image: 'path-to-image-3.png' // 替换为实际图片路径
      },
      {
        title: '1111',
        description: '一室/10000/东/临汾路1231弄',
        price: '1元/月',
        image: 'path-to-image-4.png' // 替换为实际图片路径
      }
    ]
    };
  },

  methods: {
    goToDetail() { 
      this.$router.push('/houseItem')
    }
  }
};
</script>

<style scoped>
.house-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}

.house-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 48%;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.house-item img {
  width: 100%;
  height: auto;
}

.house-info {
  padding: 10px;
}

.house-info h3 {
  margin: 0;
  font-size: 18px;
}

.house-info p {
  margin: 5px 0;
  font-size: 14px;
}

.house-info span {
  font-size: 16px;
  color: #ff6600;
}
</style>
